#include "HttpClientSub.h"

HttpClientSub::HttpClientSub(void)
{
}

HttpClientSub::~HttpClientSub(void)
{
}

int HttpClientSub::RequestURL( std::string url,char buffer[],int& nBuf )
{
	memset(buffer,0,nBuf);
	std::string str="";
	if ("status"==url)
	{
		str="{\"status\":\"0\",\"cacheTimeStamp\":\"1326351373900\"}";
	}
	else if("slots"==url)
	{
		str="																							\
		{																								\
			\"Slot\":[																					\
			{\"id\":\"1\",\"width\":\"180\",\"height\":\"109\",\"xPos\":\"451\", \"yPos\":\"300\"},		\
			{\"id\":\"3\",\"width\":\"180\",\"height\":\"109\",\"xPos\":\"451\", \"yPos\":\"300\"},		\
			{\"id\":\"9\",\"width\":\"180\",\"height\":\"109\",\"xPos\":\"451\", \"yPos\":\"300\"}		\
			],																							\
			\"retcode\":\"0\"																			\
		}";
	}
	else if("adlist"==url)
	{
		//str="{\"status\":\"0\",\"cacheTimeStamp\":\"1326351373900\"}";
	}

	nBuf=str.size();

	if (str.size()>nBuf)
	{
		return -1;
	}
	else
	{
		memcpy(buffer,str.c_str(),str.size());

	}
	return 0;
}
